<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .con{
            display: flex;
            justify-content: space-between;
        }
        .box{
            width: 300px;
            height: 300px;
            border: 1px solid saddlebrown;
            text-align: center;
            line-height: 300px;
        }
    </style>
</head>
<body>
    <div class="con">
       <div class="box">box1</div>
        <div class="box">box2</div>
        <div class="box">box3</div> 
    </div>
    
</body>
<script>
    //querySelectorAll里可以写任何类型的标签
    let boxList = document.querySelectorAll('.box')
    for(let i=0;i<boxList.length;i++) {
        boxList[i].style.background = 'blue'
    }

    //querySelectot选择特定选择器的第一个元素
    let box1 = document.querySelector('.box')
    alert(box1.innerHTML)

    box1.classList.add('')
    box1.classList.remove('')
</script>
</html>